<?php namespace web\home\controller;
/**
 * Created by PhpStorm.
 * User: qianchenmiao
 * Date: 2016/10/13
 * Time: 1:59
 */
class User{
	private $model;
	public function __construct()
	{
		$this->model=new \system\model\HomeUser();
	}

	public  function register(){

		if(IS_POST){
			if($this->model->register()){
				message('注册成功',u('login'),'success');
			}
			message($this->model->getError(),'','error');
		}
		View::make();
	}
	//验证码
	public function code(){
		Code::num(2)->make();
	}
	//登录
	public  function login(){

		if(IS_POST){
			if($this->model->login()){
				message('登录成功',u('entry.index'),'success');
			}
			message($this->model->getError(),'back','error');
		}



		View::make();
	}
	//	重置密码
		public function changePass(){

			if(IS_POST){
				if($this->model->changePass()){
					message('重置成功',u('login'),'success');
				}
				message($this->model->getError(),'','error');
			}
			View::make();
		}
	//退出
	public function del(){
		session_unset();
		session_destroy();
		go('entry.index');
	}
}